package com.zyg.apart.service.impl;

import java.util.List;
import java.util.Map;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zyg.apart.mapper.FlatrepairMapper;
import com.zyg.apart.model.Flatrepair;
import com.zyg.apart.service.FlatrepairService;
import com.zyg.apart.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FlatrepairServiceImpl implements FlatrepairService {
	@Autowired
	private FlatrepairMapper flatrepairMapper;

	@Override
	public PageInfo<Map<String, Object>> getAllRepair(Integer currentPage) {
		PageHelper.startPage(currentPage, Const.pageSize);
		List<Map<String,Object>> list = flatrepairMapper.getAllRepair();
		PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(list);
		return pageInfo;
	}

	@Override
	public Map<String,Object> getRepairById(Integer id) {
		return flatrepairMapper.getRepairById(id);
	}

	@Override
	public int editRepair(Flatrepair flatrepair) {
		return flatrepairMapper.editRepair(flatrepair);
	}

	@Override
	public int addRepair(Flatrepair flatrepair) {
		return flatrepairMapper.addRepair(flatrepair);
	}

	@Override
	public int delRepairById(Integer id) {
		return flatrepairMapper.delRepairById(id);
	}
}
